< previous page page_422 next page >

Page 422
Customizing the Feedback
Customized feedback is provided by inserting code into the OLEDragOver event of the target control or the OLEGiveFeedback event of the source control. The OLEGiveFeedback event is triggered automatically whenever the effect argument of the OLEDragOver event is changed. In this event, you can change the default behavior of the mouse pointer based on the effect argument. The OLEGiveFeedback event's two arguments enable you to check the effects allowed and then modify the mouse pointer as needed.
The effect argument, like the other OLE drag-and-drop events, specifies whether data is to be copied, moved, or rejected. The purpose of this argument is to enable you to provide customized feedback to the user by changing the mouse pointer indicating the current action.
The defaultcursors argument specifies whether the default OLE mouse pointers will be used. Setting this argument to False enables you to specify your own cursors using the Screen.MousePointer property of the Screen object.
Tip
Unless you really want unique mousepointers in your application, it is unnecessary to change the default pointers, because the default behavior of the mouse is handled by OLE.

An example of how to specify custom mousepointers for the copy, move, and scroll effects is shown in Listing 15.4.
LISTING 15.4. CUSTOMMOUSE.TXTCUSTOMIZING THE MOUSE POINTERS IN THE APPLICATION CODE.

8694cbadb9b1ef7075903f6f95fc1db2.gif
 1: Private Sub TxtSource_OLEGiveFeedback(Effect As Long, DefaultCursors As _
    Boolean)
 2:     DefaultCursors = False
 3:     If Effect = vbDropEffectNone Then
 4:         Screen.MousePointer = vbNoDrop
 5:     ElseIf Effect = vbDropEffectCopy Then
 6:            Screen.MousePointer = vbCustom
 7:            Screen.MouseIcon = LoadPicture(c:\Program Files\devstudio\_
 8: vb\icons\copy.ico)
 9:     Elself Effect = (vbDropEffectCopy Or vbDropEffectScroll) Then
10:            Screen.MousePointer = vbCustom
11:            Screen.MouseIcon = LoadPicture(c:\Program Files\devstudio\_
12: vb\icons\copyscrl.ico)
13:     Elself Effect = vbDropEffectMove Then
14:            Screen.MousePointer = vbCustom

 
< previous page page_422 next page >

If you like this book, buy it!